UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QjvT1qQQPtLxCq2lUwnCLWDwSXH8tQyBB4USxU6MPQk='
WHERE
key_id = '1bab174422b13c5960a9c891d93796e81d14520969617ca65db03e763efc31c3'
AND (
token = 'QjvT1qQQPtLxCq2lUwnCLWDwSXH8tQyBB4USxU6MPQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)