UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vXxIRXtfJudx8QXahcw9MY+lgrPqggJqkay+PEYNbcc=' 
WHERE 
  key_id = '7e5542915df697235a3068e94fb5d5934a1ea0978e9e6081132efff2f30a7135' 
  AND (
    token = 'vXxIRXtfJudx8QXahcw9MY+lgrPqggJqkay+PEYNbcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035