UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7XHwzaFWRwNx75IPBtlt5a32CjrKlYaqkeJIc0t2gJk='
WHERE
key_id = '1b112254c021e5b9954925bb6bd9c90a0495863d989ec5b902cd2846caaf3583'
AND (
token = '7XHwzaFWRwNx75IPBtlt5a32CjrKlYaqkeJIc0t2gJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)