UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F0btf1EChsqNM2HtnaRayPm7bLvm/WuehJ8uD+NpcqQ=' 
WHERE 
  key_id = 'f4e3fd05b8bb541a0d96aa54f01392edd380b0a6d72bf0fb8add27711a6ae660' 
  AND (
    token = 'F0btf1EChsqNM2HtnaRayPm7bLvm/WuehJ8uD+NpcqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042