UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rshSvt9tyjVVsNgRh8X0bMTiwmeUnpNc91B9Ti8/+Ck=' 
WHERE 
  key_id = 'ad269aa0a36bb991fa4da41161daf138cc3e47bbe21674dad7f45b008adc2188' 
  AND (
    token = 'rshSvt9tyjVVsNgRh8X0bMTiwmeUnpNc91B9Ti8/+Ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023