UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OuWSr7bSOf4612w+9pKEy6UOjBWVsMX11nEfwLvWJxQ=' 
WHERE 
  key_id = '776db8d6242a9bf97ba6d23de9b365d771e669c9302a2e80fe52305bb58f0e5b' 
  AND (
    token = 'OuWSr7bSOf4612w+9pKEy6UOjBWVsMX11nEfwLvWJxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030