UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N6LvXg8JeEbMnv+PfJWFYhkQNEf2BoFGemE19NCr4kI='
WHERE
key_id = '8b207a4ea8f40290a139ed16485d1e646c9a587fc6ab46be870eb57f9ed96c1e'
AND (
token = 'N6LvXg8JeEbMnv+PfJWFYhkQNEf2BoFGemE19NCr4kI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)