UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Y2SBbCkrm0al011vhW38mlN1KohfCR8HVpfdaDiMvM=' 
WHERE 
  key_id = '1365bb41b7442d4de84b98e997a3cc6807f6caea248990a9ae54145bd68f7046' 
  AND (
    token = '+Y2SBbCkrm0al011vhW38mlN1KohfCR8HVpfdaDiMvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036