UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XSARZkK/sQp+yzN3lWBUsM7H1ff4+FCbOoIwtSW04mk=' 
WHERE 
  key_id = 'f2d485d4fc19c8983c9019c75ce549246b0af7e5cd16b3d2e826ec905b1ef3a0' 
  AND (
    token = 'XSARZkK/sQp+yzN3lWBUsM7H1ff4+FCbOoIwtSW04mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020