UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4T49kzMWRWBXdc94xL1OyHbBKv+OdGtyIcMFk7kFQJM='
WHERE
key_id = 'b8fa83b2bd6887750fc48913537ed977f6e1c17507599e1d6d55d70c2c1d3647'
AND (
token = '4T49kzMWRWBXdc94xL1OyHbBKv+OdGtyIcMFk7kFQJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)