UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '80vpLlVrLTisKMS/J/33QhQEPEWn8TiG9ZYjf6arewM=' 
WHERE 
  key_id = '21e18ae6a5ac62dd2bbc87c8b52062507d24d6e88bcf5b2b805dcfc64caed034' 
  AND (
    token = '80vpLlVrLTisKMS/J/33QhQEPEWn8TiG9ZYjf6arewM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040