UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ozWaW7eTYOSphF9nL2i3jdjZeCVvPPcaJlFhA04P0yE=' 
WHERE 
  key_id = '8f50b6f7d3a30d2735c9a117922a5786cfd054a7e70e249805ebcf9a2e4eaa3c' 
  AND (
    token = 'ozWaW7eTYOSphF9nL2i3jdjZeCVvPPcaJlFhA04P0yE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048