UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8di4rBgJohR2iSVl9nEWs4q7+QaLcMlVpwU3LvvPAUw='
WHERE
key_id = '0711902ff57f503f0eb4f8fc814c292276351eab84af1857192d0f5caf464d9b'
AND (
token = '8di4rBgJohR2iSVl9nEWs4q7+QaLcMlVpwU3LvvPAUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)