UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '37vX/pGX83boVDfF3O+OihfbhqMrOh2ogx3f/h3HkKE=' 
WHERE 
  key_id = '66be07348d279f5b8cf29659ed654f5306986c202d183b49ad524da20261679e' 
  AND (
    token = '37vX/pGX83boVDfF3O+OihfbhqMrOh2ogx3f/h3HkKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017