UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MVzyCH2aCGcXA8v4V24+IX2AeK0EdHcYIy9+45grn50=' 
WHERE 
  key_id = '27d8fda186679d59a1ad340cba2eae9cff5ae3900fffdf8bf0396f9204d38265' 
  AND (
    token = 'MVzyCH2aCGcXA8v4V24+IX2AeK0EdHcYIy9+45grn50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025