UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ygwc8DS7iTYsoOKgaEN3gcHVQyC9AguYqrqrT6x9pRI=' 
WHERE 
  key_id = '9e82fe8fd6afb5311f793fc243f8dc3c4300bc0d4b71d844e0fb885d79333ad9' 
  AND (
    token = 'ygwc8DS7iTYsoOKgaEN3gcHVQyC9AguYqrqrT6x9pRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024