UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBMotQqYZ6cI2NFmqsPUri9wh9BFnbwdBTUbP02WWS8=' 
WHERE 
  key_id = '1e834ddc2fe96899fd49659555c4322d290327cbf49cc251d63d8be56e852219' 
  AND (
    token = 'fBMotQqYZ6cI2NFmqsPUri9wh9BFnbwdBTUbP02WWS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049