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

Query time 0.00039