UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jf4XdcShlpT7vg6+/Ct2PFA6lU75K53kOxnh+TyyO0E=' 
WHERE 
  key_id = '56df06ea6435cc3c27c7165e9b1f02f996de91e6da2b5b19cef62201e38e4400' 
  AND (
    token = 'Jf4XdcShlpT7vg6+/Ct2PFA6lU75K53kOxnh+TyyO0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038