UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1SdvUxYY/C9wISok005dpI0fnc0a5iSaqoBoL/RDfpw=' 
WHERE 
  key_id = '51f0fd15b07c28c4bd516d4c2a6d839f7acbbb852667ee219889b76ff4a96f67' 
  AND (
    token = '1SdvUxYY/C9wISok005dpI0fnc0a5iSaqoBoL/RDfpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037