UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a1B5XJyaFzj6xWgWXxr53A3APOz0+wwlYfqItgmOCFw=' 
WHERE 
  key_id = '50285fb368ddb787fb75de397f270046acceff25dbc1db2e89ab252b541d13d5' 
  AND (
    token = 'a1B5XJyaFzj6xWgWXxr53A3APOz0+wwlYfqItgmOCFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031