UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W5v3NoANgIA8OaAQpd2JUl1pHPQhn4e/mIx/OJCYm1M='
WHERE
key_id = '23ba50b51a6935635b48112068837a27fbf73a05dcad71c10e80d89167509f45'
AND (
token = 'W5v3NoANgIA8OaAQpd2JUl1pHPQhn4e/mIx/OJCYm1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)