UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8B0Ju7bWbBqZbKu/ybHaIYpZiY8et8RAg2y70ntXeZY='
WHERE
key_id = '23aa3ee67103303709255d4ebaff7833a69c8bf88ba63234fa437f264819c52a'
AND (
token = '8B0Ju7bWbBqZbKu/ybHaIYpZiY8et8RAg2y70ntXeZY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)