UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KaUGobkKRkwU53T4IKfE7iNPk8QTMo71hKT1LHhKN0U='
WHERE
key_id = 'd9bd8e0fc99df06c2a828dbb21c4cd4e4d94b6b1ae2f0562b7514fcef6024dab'
AND (
token = 'KaUGobkKRkwU53T4IKfE7iNPk8QTMo71hKT1LHhKN0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)