UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qDXy+8wGK5C6wSmY8nRz0QwBA6RvhYvInao3LNynDHw=' 
WHERE 
  key_id = '2d97b5d4d73d10a96477260bd73269440843484f895dd72f2250d752bb0b27ff' 
  AND (
    token = 'qDXy+8wGK5C6wSmY8nRz0QwBA6RvhYvInao3LNynDHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029