UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0QERu+xAt3XLhSzLz+x7f2UCmzzy01W9DPztqiObup4='
WHERE
key_id = '361833fde85fda8a820ffde4fc485185a42fe526ca7ebd7e40a61335f95f5691'
AND (
token = '0QERu+xAt3XLhSzLz+x7f2UCmzzy01W9DPztqiObup4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)