UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+SH0r09qDIDNeLC5XEJY5msGCn8HOvFcCuoQMB2sVk=' 
WHERE 
  key_id = 'ca9a135d37c7df4414cf930a2e66439d60fb3d6badb794a1acaf14033e2207eb' 
  AND (
    token = 'H+SH0r09qDIDNeLC5XEJY5msGCn8HOvFcCuoQMB2sVk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026