UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7JPw7UZAZFAl/wYAtWhL1RrV+c+C61nTuGJI3zbeSE='
WHERE
key_id = '8efaac379860e786f97c8c38d0354f40f545931bfb0aa9eafd64490c3bf85854'
AND (
token = 'r7JPw7UZAZFAl/wYAtWhL1RrV+c+C61nTuGJI3zbeSE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)