UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a0MLg/cqWmv5ln5FreUOAdpCP9RHwCgFGrI3ShaBwek='
WHERE
key_id = '000bf00b28512a9c83ba0a895e85aabfedddec2e20b79eaaeba754909fb63ec9'
AND (
token = 'a0MLg/cqWmv5ln5FreUOAdpCP9RHwCgFGrI3ShaBwek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)