UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UZIwzkUgFRiTlq9MGS1Xmb99NSYci8pxtmUiAjaclIo=' 
WHERE 
  key_id = '66ca238b2c132c0b35679ee93a214daf8de9d57770b65f33e6ca3a83849df556' 
  AND (
    token = 'UZIwzkUgFRiTlq9MGS1Xmb99NSYci8pxtmUiAjaclIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019