UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X6DhLAKsusAraqVvG/3kJaXDAAgtCBgfY26V1DCtKgs='
WHERE
key_id = 'e9db13c1d4eb508d20514d23356a8a555dee61e589c47ab67b080f4fe7a5e933'
AND (
token = 'X6DhLAKsusAraqVvG/3kJaXDAAgtCBgfY26V1DCtKgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)