UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9V2ht2lngxaYIz4BdcQ7UWlPcvwKjgC/kHaNILvMHU='
WHERE
key_id = 'd1ad1274627768f40ed9dfa541ee6d44e047f95b4322026673b29af20994f710'
AND (
token = 'd9V2ht2lngxaYIz4BdcQ7UWlPcvwKjgC/kHaNILvMHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)