UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yo88mL3Q8Aazt3dpoN3rxar/XcOSQ/KRN124Q53J3oU=' 
WHERE 
  key_id = '899f9664619c1b77e2ab1e6a196626c6794ef59a789acdbe76b74224af9c798b' 
  AND (
    token = 'Yo88mL3Q8Aazt3dpoN3rxar/XcOSQ/KRN124Q53J3oU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023