UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O7SNWKhv8iTy6PvYEWlte41jX8bqr8QzcCdgICFXLPo=' 
WHERE 
  key_id = '2d2b4efaf21484fb6443ce49292a72209de20c97f285146adf48c83010572da8' 
  AND (
    token = 'O7SNWKhv8iTy6PvYEWlte41jX8bqr8QzcCdgICFXLPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036