UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9wbOx856LosulqtQikbnNb5baHvpOUnh/K2xabys+3c='
WHERE
key_id = 'ad6e596955fa07e523ee80d79ecc150bd78c55e5095a52c970f14a0838cd04a3'
AND (
token = '9wbOx856LosulqtQikbnNb5baHvpOUnh/K2xabys+3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)