UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q36XoY9mf+qwGzf10TG3bRSCiODm1vkLoAbIBdgS4KM='
WHERE
key_id = 'a012905e09ef29e82a65f9f28fcbef77f9c9f92815c6bc35b9b7a794a4540352'
AND (
token = 'q36XoY9mf+qwGzf10TG3bRSCiODm1vkLoAbIBdgS4KM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)