UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QHKmpBqzztStABalltC2+AjFi4J17/zJ8Zem+CDyp44=' 
WHERE 
  key_id = '2e39070ffb6d6706043d0812d861ab39b0c7dd9fa1a0f92277ccaba5f8413913' 
  AND (
    token = 'QHKmpBqzztStABalltC2+AjFi4J17/zJ8Zem+CDyp44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026