UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1LpG+gE6ib0GuPNdL+vypSonuauGo5GqPzRcXVm698k=' 
WHERE 
  key_id = '0a0229635dfb38183a17c4646b20b7d010b0a6de3196cde1ed99a617da82b5de' 
  AND (
    token = '1LpG+gE6ib0GuPNdL+vypSonuauGo5GqPzRcXVm698k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030