UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jMvezB45okftZg8OetTIui73EE9w1tmrCnf121Rij+o=' 
WHERE 
  key_id = '736fffb6b8afb9009dec6982f00f94a6566cfbc9ab397b45eb5a4bc63a09a257' 
  AND (
    token = 'jMvezB45okftZg8OetTIui73EE9w1tmrCnf121Rij+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030