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

Query time 0.00061