UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'olnSd+fks22Xn7qCZsvzsiTNY50SkYlObQZxdE+g4Dk='
WHERE
key_id = '4ca3933fe5a3970f663a0f9d1835ac2d3e2b46e46238d7746a751a392b4e4615'
AND (
token = 'olnSd+fks22Xn7qCZsvzsiTNY50SkYlObQZxdE+g4Dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)