UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XsYBE5/iYL5ISvy2fYgEK6KfIsvPq3BGkVztpcvVi9o='
WHERE
key_id = 'be962d40f0023f5362a4592fdaa4eb157c986db7fded29e9cd80ad44f61aaae1'
AND (
token = 'XsYBE5/iYL5ISvy2fYgEK6KfIsvPq3BGkVztpcvVi9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)