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

Query time 0.00043