UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBrqLqlRcViqX+37uUvIfwZKnUWrmblgsSFro3GfrTg=' 
WHERE 
  key_id = '5ebea342021f91973668c9f87e859ca24cfe593b69c8671fe63003d3237bb8a6' 
  AND (
    token = 'dBrqLqlRcViqX+37uUvIfwZKnUWrmblgsSFro3GfrTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051