UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5yCFOorFoA5VG39H1GMKJSMl/C7yM3pzWjNByMZdvKs='
WHERE
key_id = '396d1024bb2b66abe09946496bd62226f18f64caff24dcad77ff5b20faec34bf'
AND (
token = '5yCFOorFoA5VG39H1GMKJSMl/C7yM3pzWjNByMZdvKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)