UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SJSjT29yyJ+qrUmbJW4aaNnS1m8rJiwL69wzp1Lmizo=' 
WHERE 
  key_id = '398db6a62d60c802d6a8105e255b20efeaf61de8b0affec33dbb9119405b8f9c' 
  AND (
    token = 'SJSjT29yyJ+qrUmbJW4aaNnS1m8rJiwL69wzp1Lmizo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043