UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zw5eWM+q/T15Ak6LQP5QVzu6chvkhoA5/1njjOvvU5U=' 
WHERE 
  key_id = '899f63631887206fb98552a40a2d497792d93812ac72057e35e356cfea452dad' 
  AND (
    token = 'zw5eWM+q/T15Ak6LQP5QVzu6chvkhoA5/1njjOvvU5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020