UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sn2OEpRcYFjrn3JdQCHPgy6gKru5wBXACRW/tIkxM0M='
WHERE
key_id = 'ddfb9fcb166af4925ac3cc709e8d665c1662d3684a36707714e3bb2d2279d537'
AND (
token = 'Sn2OEpRcYFjrn3JdQCHPgy6gKru5wBXACRW/tIkxM0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)