UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'au8sVQaNGH3EIA6th4dEbGn2QdyCvhxIbKOuuTkbTAk='
WHERE
key_id = '039dd975dc2e67573047fa12fbdb2ca6c533947f4175b1828e39690843e69c8c'
AND (
token = 'au8sVQaNGH3EIA6th4dEbGn2QdyCvhxIbKOuuTkbTAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)