UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4uJ5L/Ft5K4zW3ohFUfpP7BLmw+JlfpSx6Bm/uc74g=' 
WHERE 
  key_id = 'd580dd3dc01d4f2b0475196968c5647ad4f81f7f1fda386e4dd8b27e56038f5c' 
  AND (
    token = 'y4uJ5L/Ft5K4zW3ohFUfpP7BLmw+JlfpSx6Bm/uc74g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056