UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dzJkyVLBpWggpmH0vYLAUBOC0vnnVYMNCK0ltvDt0us='
WHERE
key_id = '509353d159dd75465876368e236469217832a11ee02a5e833fee819519dc8c14'
AND (
token = 'dzJkyVLBpWggpmH0vYLAUBOC0vnnVYMNCK0ltvDt0us='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)