UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ty67JqGNN610UNFx8rUmhcSW97fp8k1S/sUZ31VIkGM=' 
WHERE 
  key_id = '23b5f46ef46b6dae158395421e945dd6657c1ce0d0eb7387183ecec25404f67d' 
  AND (
    token = 'Ty67JqGNN610UNFx8rUmhcSW97fp8k1S/sUZ31VIkGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035