UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ns9+r0Fo7skXw/S9xoQCooGO7fA4BJP806WnYDf3Fgs=' 
WHERE 
  key_id = '36145cfcc28fd126dd840dc0959fddb2e00336bd649fd9d37a3abbd17ed0fd02' 
  AND (
    token = 'ns9+r0Fo7skXw/S9xoQCooGO7fA4BJP806WnYDf3Fgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023