UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S7jwQBeQ1VjYZomz8Pu/cIzcza7TFPT5xbOHkPvacu4='
WHERE
key_id = '9a4f449a6afba5bf310effe36fc9492d186bf64350835ab3997ff8c1bf535ac0'
AND (
token = 'S7jwQBeQ1VjYZomz8Pu/cIzcza7TFPT5xbOHkPvacu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)