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

Query time 0.00048