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

Query time 0.00032