UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BybkFdWgmd2qwdjryvDjIotD2eH9Yjzcr+2GL6vw0K4='
WHERE
key_id = '799691bf193796d4cc5063751a8500a1d47df0e1c491ef503f86821fd99072ad'
AND (
token = 'BybkFdWgmd2qwdjryvDjIotD2eH9Yjzcr+2GL6vw0K4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)