UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OoxFOJPgPRqs9OkrTwfYKgdomCEXGprhX5Y4SmfhRM8=' 
WHERE 
  key_id = 'c02915ee7a54932d53ac6da7711ed49fadda6dc14b4d6533284972a9bc6aaee6' 
  AND (
    token = 'OoxFOJPgPRqs9OkrTwfYKgdomCEXGprhX5Y4SmfhRM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039