UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RrLUnN5xM0ApIRCRwKeUIIrVmLMFY9UEqz0BgTDlX4g=' 
WHERE 
  key_id = 'd17490b2de43b8025aee90a719199823182958d512ec3cb399e63dcca28660a1' 
  AND (
    token = 'RrLUnN5xM0ApIRCRwKeUIIrVmLMFY9UEqz0BgTDlX4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032