UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YhIK5kOhnNBHQinQYvFxw8Ba5kB4+bNJRsJEkowaBII=' 
WHERE 
  key_id = 'aeae1abf7f49a75780b5eda47cef84bb4d2f88357486591686564199c722c14c' 
  AND (
    token = 'YhIK5kOhnNBHQinQYvFxw8Ba5kB4+bNJRsJEkowaBII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050