UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'imh/+qNzyfer8yla85SjplWpqW6HoBXJi72ADXLFujM=' 
WHERE 
  key_id = '12bfda5271f147ba9bd45374c941dd65eda1c7b64c9a05b4304ab9f3dd1b8411' 
  AND (
    token = 'imh/+qNzyfer8yla85SjplWpqW6HoBXJi72ADXLFujM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029