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

Query time 0.00023