UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ztFww96grN1Z50xVsJ2JUal1uY6Xr8X6AHuMUMNhJEc=' 
WHERE 
  key_id = '4b14a6e45a9ea9706566aa3d7d14d7ed576dbc391a7732c7938fb361c2bf022a' 
  AND (
    token = 'ztFww96grN1Z50xVsJ2JUal1uY6Xr8X6AHuMUMNhJEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027