UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k2TWPEEUwjTQTTxuHbq8BTv0EuQkb8W+tiST85BJZY0='
WHERE
key_id = '8a4bb3093bedfbac286050c8d464abdc61624e1aedef4e5a45e20e254386a2c7'
AND (
token = 'k2TWPEEUwjTQTTxuHbq8BTv0EuQkb8W+tiST85BJZY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)