UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XdDcp3e7aG36EYlLAYF+p7to1DVxep4UEs25J4RznQU=' 
WHERE 
  key_id = '83adee31ad5a4feb6da106e7e119d1873b45e8ee1da9de1ffca6ed0e8c7f14ca' 
  AND (
    token = 'XdDcp3e7aG36EYlLAYF+p7to1DVxep4UEs25J4RznQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041