UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4y0jmHRJXcpm+tDzMdjlok+IgBc/ySgpBS9yG3HKOpo='
WHERE
key_id = 'ec7647e8196d47d49fda098bbc54990bd623590f12e11692096b439c782f75c7'
AND (
token = '4y0jmHRJXcpm+tDzMdjlok+IgBc/ySgpBS9yG3HKOpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)